//
//  String+Extensions.swift
//  status
//
//  Created by 彳亍 on 2017/3/22.
//  Copyright © 2017年 彳亍. All rights reserved.
//

import Foundation

// MARK: - 文件路径
extension String {
    
    /// 获取沙盒路径
    ///
    /// - Parameter fileName: 文件名
    /// - Returns: 沙盒路径
    static func ch_sandboxDir(fileName:String) -> String {
        let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
        return (path as NSString).appendingPathComponent(fileName)
    }
    
    /// 获取main bundle 路径
    ///
    /// - Parameter fileName: 文件名
    /// - Returns: 文件路径
    static func ch_bundleDir(fileName:String) -> String {
        return Bundle.main.path(forResource: fileName, ofType: nil) ?? ""
    }
    
}
